package com.qiguliuxing.dts.admin.dao;

import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.handler.context.CellWriteHandlerContext;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;

public class WriteOnlyValueHandler implements CellWriteHandler {
    @Override
    public void afterCellDispose(CellWriteHandlerContext context) {
        Cell cell = context.getCell();
        cell.setCellType(CellType.STRING); // 设置单元格类型为String
        cell.setCellValue(cell.getStringCellValue()); // 重新设置值，此时只写入值，不包含公式或样式
    }
}